import requests
import time
import os


def main():
    money = 0
    number = 0
    ts = str(int(time.time()))
    print(ts)
    nodejs = os.popen('node 01 ' + ts + '000')
    print(nodejs)
    m = nodejs.read().replace('\n', '')+'|'+ts
    print(m)
    nodejs.close()
    for page in range(1, 6):
        print(page)
        url = 'http://match.yuanrenxue.com/api/match/1?page='+str(page)+'&m='+m
        print(url)
        response = requests.get(url).json()
        print(response)
        for each in response['data']:
            money += each['value']
            number += 1
    print(money)
    print(number)
    print(money//number)
    # 总价
    # 总数
    # 均值

if __name__ == '__main__':
    main()